var GenericExtensionText = GFExtensionText.extend({
	factory: null,
	li_obj: null,
	constructor: function()
	{
		this.li_obj = document.createElement('li');
	},
	Destroy: function() { return this.factory.DestroyNode(this.li_obj); },
	SetText: function(text)
	{
		this.li_obj.innerHTML = text;
	},
	GetText: function()
	{
		return this.li_obj.innerHTML;
	},
	SetClickHandler: function(handler)
	{
		this.li_obj.onclick = handler;
	}
});

var GenericExtensionDropBox = GFExtensionDropBox.extend({
	factory: null,
	li_obj: null,
	text: null,
	menu_node: null,
	constructor: function()
	{
		var x = this;
		this.li_obj = document.createElement('li');
		this.li_obj.onclick = function() { return x.click_handler(); };
	},
	Destroy: function() { return this.factory.DestroyNode(this.li_obj); },
	SetText: function(text)
	{
		this.text = text;
		this.li_obj.innerHTML = text + lib.utf16char(0x25bc);
	},
	GetText: function()
	{
		return this.text;
	},
	SetMenuNode: function(node)
	{
		this.menu_node = node;
	},
	click_handler: function()
	{
		var pos = JSVKBrowserExtension.getOffset(this.li_obj);

		x = pos.x;
		y = pos.y + pos.height;
		pos = GFWindowsMovableHandler.FixPosition(x,y);
		x = pos[0]; y = pos[1];
		if(this.menu_node.GetCount() > 9) GownFull.instance.menu.PopupCustomMenu(this.menu_node);
		else GownFull.instance.menu.PopupCustomMenu(this.menu_node,true);
		GownFull.instance.candwin.SetWindowPosition(x,y);
	}
});

var GenericExtensionAreaFactory = GFExtensionAreaFactory.extend({
	ul_obj: null,
	node_after: null,
	constructor: function(ul_obj,node_after)
	{
		this.ul_obj = ul_obj;
		this.node_after = node_after;
	},
	CreateNode: function(node)
	{
		this.ul_obj.insertBefore(node,this.node_after);
		return true;
	},
	DestroyNode: function(node)
	{
		this.ul_obj.removeChild(node);
		return true;
	},
	CreateText: function()
	{
		var text = new GenericExtensionText;
		this.CreateNode(text.li_obj);
		text.factory = this;
		return text;
	},
	CreateDropBox: function()
	{
		var dropbox = new GenericExtensionDropBox;
		this.CreateNode(dropbox.li_obj);
		dropbox.factory = this;
		return dropbox;
	}
});
